package com.neidetcher.tuml.model;

import java.util.List;

public class Object
{
   private String type;
   private String name;
   private int xLifeLine;
   private List<Method> methods;
   
   public Object(String nameIn, String typeIn)
   {
      name = nameIn;
      type = typeIn;
   }
   
   /** this constructor parses the input lines */
   public Object(String objectStringIn)
   {
      int colonLoc = objectStringIn.indexOf(":");
      if (colonLoc == -1)
      {
         throw new IllegalArgumentException(
               "object did not have a colon, must be of form <name>:<type>: " + objectStringIn);
      }
      name = objectStringIn.substring(0, colonLoc);
      type = objectStringIn.substring(colonLoc + 1, objectStringIn.length());
   }
   
   public String getName()
   {
      return name;
   }

   public String getType()
   {
      return type;
   }
   
   public String toString()
   {
      return name + ":" + type;
   }

   /**
    * location on the x-axis of the life-line of this object when doing sequence diagrams 
    */
   public int getXLifeLine()
   {
      return xLifeLine;
   }

   /**
    * location on the x-axis of the life-line of this object when doing sequence diagrams 
    */
   public void setXLifeLine(int lifeLine)
   {
      xLifeLine = lifeLine;
   }

   public List<Method> getMethods()
   {
      return methods;
   }

   public void setMethods(List<Method> methods)
   {
      this.methods = methods;
   }
}
